<%@page import="java.sql.ResultSet" import="java.text.SimpleDateFormat"
import="java.util.Date"%>
<%@page import="com.tzq.JAVABEAN.ConnectDB"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



<html>
<%
boolean flag = false;
String userid= null;
String param = request.getParameter("q");
//formate datetime
SimpleDateFormat dff = new SimpleDateFormat("yyyyMMddHHmmss");
//查询是否有改数据
String sql = "select * from ResetPwdUri where Uri='"+param+"'";
ConnectDB conn = new ConnectDB();
ResultSet rs = conn.executeQuery(sql);
if(rs.next()){
	if(rs.getString(1)!=null&&rs.getString(1).length()!=0){
	   userid = rs.getString("UserID");
       String requesttime=rs.getString("RequestTime");
       String[] SqlParam = {userid};
       int[] WhichInt = {1};
       conn.updatesql("update ResetPwdUri set Uri=null where UserID=?", SqlParam, 1, WhichInt);
       if(dff.parse(requesttime).before(new Date())){
    	   flag=false;
       }else{
    	   flag =true;
       }
	}else{
		flag = false;
	}
}
%>
<head>
	<meta http-equiv="content-type" content="text/html" />
	<meta name="author" content="blog.anchen8.net" />
	<title>毕业生，你的选择</title>
    <link rel="stylesheet" type="text/css" href="../css/GetUrl.css" />
    <script type="text/javascript">  
    function createMain(){
            var _scrollWidth=Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
            var _scrollHeight=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
                document.getElementById("main").style.left=(_scrollWidth-950)/2+"px";
               // document.getElementById("m").style.height=_scrollHeight+"px";
        }
    </script>
</head>
<body class="body">
    <div class="main" id="main">
        <div class="urllogo">
            <img src="/Bys-Website/SourceImageFile/getUrl.jpg"/>
        </div>
        <div class="ashr">
        </div>
        <%if(flag) {%>
        <form action="ResetPassword" method="post">
	        <div class="step">用户名&nbsp;&nbsp;&nbsp;重置密码</div>
	        <div class="maininfo">
	            <div class="type">新密码</div>
	            <div class="inputtext"><input type="password" name="NewPwd" /></div>
	            <input type="hidden" name ="userid" value="<%=userid%>"/>
	            <input type="submit" name="submit" value="确定" class="subbtn"/>
	            <div class="attention">请您牢记输入的新密码</div>
	        </div>
        </form>
        <%}else{ %>
       	 链接已过期！！！！
		<a href="PublicMainPage.jsp">返回主页面</a>
		<a href="/Bys-Website/Log_in.jsp">返回登录页面</a>
		<a href="GetUri.jsp">重新发邮件</a>
		<%} %>
    </div>
    
    <script>
        createMain();
    </script>
    <div class="topbar">
        <div class="logo">
            <img src="/Bys-Website/SourceImageFile/toplogo.jpg"/>
        </div>
        <div class="navi">
            <ul class="naviul">
                <li><a href="/Bys-Website/Public/Video.jsp" class="outli">视频</a></li>
				<li><a href="/Bys-Website/Public/Photo.jsp" class="outli">相册</a></li>
				<li><a href="/Bys-Website/Public/Blog.jsp" class="inli">博客</a></li>
            </ul>
        </div>
        <div class="loginfo">
            <ul class="loginfoul">
				<%if(session.getAttribute("pid")==null){%>
				<li><a href="/Bys-Website/Log_in.jsp">登录</a></li>
				<li><a href="/Bys-Website/Regist.jsp">注册</a></li>
			<%}else{
				 String Sessionid=session.getAttribute("pid").toString();%>
				<li><a href="../PersonMainPage.jsp?userID=<%=Sessionid  %>"><%=session.getAttribute("username").toString()%></a></li>
				<li><a href="../LoginServlet?method=1">退出</a></li>
			<%}%>
			</ul>
        </div>
    </div>
</body>
</html>